import { Table } from "antd";
import React, { useState } from "react";

const TableDesc = ({ type }: { type: string }) => {
  const [dataSource, setDataSource] = useState<any>({
    users: [
      {
        key: 1,
        name: "张三",
        age: 18,
        sex: "男",
        phone: "13800138000",
        department: "部门1",
      },
      {
        key: 2,
        name: "李四",
        age: 20,
        sex: "女",
        phone: "13800138001",
        department: "部门2",
      },
      {
        key: 3,
        name: "王五",
        age: 22,
        sex: "男",
        phone: "13800138002",
        department: "部门3",
      },
      {
        key: 4,
        name: "赵六",
        age: 24,
        sex: "女",
        phone: "13800138003",
        department: "部门4",
      },
      {
        key: 5,
        name: "孙七",
        age: 26,
        sex: "男",
        phone: "13800138004",
        department: "部门5",
      },
      {
        key: 6,
        name: "周八",
        age: 28,
        sex: "女",
        phone: "13800138005",
        department: "部门6",
      },
      {
        key: 7,
        name: "吴九",
        age: 30,
        sex: "男",
        phone: "13800138006",
        department: "部门7",
      },
    ],
    staff: [
      {
        key: 1,
        name: "张三",
        age: 18,
        sex: "男",
        phone: "13800138000",
        department: "部门1",
      },
      {
        key: 2,
        name: "李四",
        age: 20,
        sex: "女",
        phone: "13800138001",
        department: "部门2",
      },
    ],
  });
  const columns: any = {
    users: [
      {
        title: "姓名",
        dataIndex: "name",
      },
      {
        title: "年龄",
        dataIndex: "age",
      },
      {
        title: "性别",
        dataIndex: "sex",
      },
      {
        title: "手机号",
        dataIndex: "phone",
      },
      {
        title: "部门",
        dataIndex: "department",
      },
    ],
    staff: [
      {
        title: "姓名",
        dataIndex: "name",
      },
      {
        title: "年龄",
        dataIndex: "age",
      },
      {
        title: "性别",
        dataIndex: "sex",
      },
      {
        title: "手机号",
        dataIndex: "phone",
      },
      {
        title: "部门",
        dataIndex: "department",
      },
    ],
  };

  return <Table dataSource={dataSource[type]} columns={columns[type]} />;
};

export default TableDesc;
